package com.nacos.consumer.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@FeignClient(name = "nacos-provider",path = "/provider",fallback = FeginService.EchoServiceFallback.class, configuration = FeginService.FeignConfiguration.class)
public interface FeginService {

    @RequestMapping(value = "/config/get",method = RequestMethod.GET )
    String get();

    class FeignConfiguration {
        @Bean
        public EchoServiceFallback echoServiceFallback() {
            return new EchoServiceFallback();
        }
    }

    class EchoServiceFallback implements FeginService {
        @Override
        public String get() {
            return "echo fallback";
        }
    }
}
